package com.manbu.live.farmework.redis.starter.config;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.SerializationException;
/**
 * @author hanWang
 * @Title:
 * @Package
 * @Description:
 * @date 2024/1/219:29 下午
 */
public class IGenericJackson2JsonRedisSerializer extends GenericJackson2JsonRedisSerializer {
    public IGenericJackson2JsonRedisSerializer() {
        super(MapperFactory.newInstance());
    }
    @Override
    public byte[] serialize(Object source) throws
            SerializationException {
        if (source != null && ((source instanceof String) ||
                (source instanceof Character))) {
            return source.toString().getBytes();
        }
        return super.serialize(source);
    }
}